#!/usr/bin/python

import sys

with open(sys.argv[1], 'r') as f:
	count = 0
	get = 0
	put = 0
	for line in f:
		if not line.startswith("St") and not line.startswith("Fi"):
			if line.startswith("p"):
				count = count + 1
				if not put == int(line[5:]):
					print("Put Number Error")
					break
				put = put + 1
			else:
				count = count - 1
				if not get == int(line[5:]):
					print("Get Number Error")
					break
				get = get + 1
		if count < 0 or count > 10:
			print("Error")
			break

print("OK")
